package org.marsdonne.commons;

import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;

public class MemberCursorPageableImpl implements MemberCursorPageable<Member> {

    @PersistenceContext
    private EntityManager entityManager;

    @Override
    public String getCursorFieldName() {
        return "id";
    }

    @Override
    public Cursor getCursor(Specification<Member> spec, Long after) {
        return getCursor(entityManager, spec, after);
    }

    @Override
    public List<Member> pagedRecords(int first, Long after, Specification<Member> spec, Sort sort) {
        return pagedRecords(entityManager, first, after, spec, sort);
    }
}
